<template>
  <div class="container">
    <div class="cusBook">
      <div class="weui-cells weui-cells_after-title" style="margin-top:32rpx;border-top:1rpx solid #E5E5E5;border-bottom:1rpx solid #E5E5E5">
        <div class="weui-cell weui-cell_input">
          <div class="weui-cell__bd">
            <input class="weui-input" placeholder="不超过9个字符" v-model="name" :maxlength="9"/>
          </div>
        </div>
      </div>
      <div class="btnWrap">
        <div class="blueBtn" @click="addClass">添加</div>
      </div>
    </div>
  </div>
</template>

<script>
import tabBar from '../../components/tabbar'

export default {
  data () {
    return {
      name:'',
    }
  },
  components: {
    tabBar
  },
  computed: {

  },
  methods: {
    addClass(){
      if(this.name.length >0){
        wx.showToast({
        title: '添加完成',
        icon: 'success',
        duration: 1000
        });
        wx.navigateTo({
          url: '/pages/addsuccess/main'
        })
      }else{
        wx.showToast({
        title: '分类不能为空',
        icon: 'none',
        duration: 1000
      });
      }
      console.log(this.name,'name');
    },
  },

}
</script>

<style scoped lang="less">
.container{
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  .cusBook{
    width:100%;
    .btnWrap{
      padding:32rpx;
      .blueBtn{
         width:100%;
         height:96rpx;
         line-height: 96rpx;
         text-align: center;
         color:#fff;
         background: #1387FF;
         font-size:32rpx;
         border-radius:10rpx;
      }
    }
  }
}
</style>
